package com.baiyinet.rest;

import com.baiyinet.Constants.PATH;
import com.baiyinet.biz.AdInfo;
import com.google.gson.JsonObject;

import java.util.Map;

import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.PartMap;
import retrofit2.http.Query;
import rx.Observable;

/**
 * @author J.Huang
 * @version 1.0
 * @since 16/11/8
 */

public interface Api {
    @GET(PATH.API_APP_INFO)
    Observable<AppInfo> getAppInfo(@Header("Cookie") String cookie,
                                   @Query("AppOS") String appOS,
                                   @Query("RegistrationId") String registrationId);
    @GET(PATH.API_LINK)
    Observable<LinkStructure> getLink(@Header("Cookie") String cookie,
                                      @Query("AppOS") String appOS,
                                      @Query("RegistrationId") String registrationId);

    @GET(PATH.API_PAY_PARAM)
    Observable<PayParam> getPayParam(@Header("Cookie") String cookie,
                                     @Query("AttachData") String attachData,
                                     @Query("PayMethod") String payMethod);
    @Multipart
    @POST(PATH.API_UPLOAD_IMG)
    Observable<UploadImgResponse> uploadImg(@Header("Cookie") String cookie,
                                            @PartMap() Map<String, RequestBody> partMap);

    @POST(PATH.API_DOWNLOAD_IMG)
    Observable<DownloadImgResponse> downloadImg(@Header("Cookie") String cookie,
                                        @Body Map<String, String> params);

    @POST(PATH.API_START_AD)
    Observable<AdInfo> startAd(@Header("Cookie") String cookie);

    @GET(PATH.API_READ_ALL)
    Observable<ChannelInfo> readAll(@Header("Cookie") String cookie);

    @GET(PATH.API_GET_DETAIL)
    Observable<PlayerDetail> getDetail(@Header("Cookie") String cookie,
                                       @Query("RadioId") int radioId
                                       );

    @GET(PATH.API_READ_MESSAGE)
    Observable<MessageInfo> readMessage(@Header("Cookie") String cookie,
                                        @Query("RadioId") int radioId,
                                        @Query("PageNo") int pageNo,
                                        @Query("PageSize") int pageSize
                                        );

    @GET(PATH.API_ADD_MESSAGE)
    Observable<ApiResult> addMessage(@Header("Cookie") String cookie,
                                     @Query("Content") String content,
                                     @Query("RadioId") int radioId
                                     );

}
